package patterns.structures.flyweight;

import java.util.HashMap;
import java.util.Map;

public class FlyweightFactory {

	private static Map<String, Flyweight> pool = new HashMap<String, Flyweight>();

	private FlyweightFactory() {

	}

	public static Flyweight getFlyweight(String in) {
		Flyweight fw = pool.get(in);
		if (fw == null) {
			fw = new ConcreteFlyweight(in);
			pool.put(in, fw);
		}
		return fw;
	}

}
